from django.shortcuts import render
from rest_framework.generics import ListAPIView
from rest_framework.viewsets import ModelViewSet

from apps.detail.models import DetailModel
from apps.detail.serializers import DetailSerializers


class DetailView(ModelViewSet):
    serializer_class = DetailSerializers

    def get_queryset(self):
        # 获取搜索关键字
        id = self.request.query_params.get('id')
        print('点击的那个菜品id是:%s' % id)
        detail = DetailModel.objects.filter(id=id)

        return detail
